//
//  ViewController.m
//  GXZTagListView
//
//  Created by Deeokay on 2017/10/27.
//  Copyright © 2017年 GXZ. All rights reserved.
//

#import "ViewController.h"
#import "GXZTaglistView.h"

@interface ViewController ()<GXZTagListViewProtocol>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUI];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

-(void)setUI{
    NSMutableArray * taglist = [[NSMutableArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GXZTag" ofType:@"plist"]];
    //这里开始调用
    GXZTaglistView * tagView = [[GXZTaglistView alloc] gxzAlocWihtInit:CGRectMake(30, 30, [UIScreen mainScreen].bounds.size.width - 60,100) andTagList:taglist];
    tagView.delegate = self;
    tagView.backgroundColor = [UIColor orangeColor];
    //根据tag个数调整view的frame
    [tagView gxzSetUIandTaglist:taglist withHeight:^(CGFloat he) {
        tagView.frame = CGRectMake(tagView.frame.origin.x, tagView.frame.origin.y, tagView.frame.size.width, he);
    }];
    //这个方法获取到最后的tagview的高度
    CGFloat lastHeight = [tagView gxzGiveYouHeightOfView];
    NSLog(@"tagListView的高度是：%f",lastHeight);
    [self.view addSubview:tagView];
    
}
-(void)gxzTagListView:(GXZTaglistView *)listView didSelectedAtIndex:(int)index showTitle:(NSString *)title{
    NSLog(@"index====%d,title=====%@",index,title);
    
    
    
}
@end
